/**
 * 
 */
package com.momosw.games.engine.player;

import java.util.List;
import java.util.Random;

import com.momosw.games.engine.Option;
import com.momosw.games.jericho.actions.PlayCardAction;
import com.momosw.games.jericho.board.WallCard;

/**
 * <b>Project:</b> JerichoCardGame<br />
 * <b>Package:</b> com.momosw.games.engine.player<br />
 * <b>Class:</b> BuilderPlayer.java<br />
 * <br />
 * <i>GSI 2011</i><br />
 *
 * @author Miguel Coronado (miguelcb84@gmail.com)
 * @version	Aug 22, 2011
 *
 */
public class BuilderPlayer extends ComputerPlayer {

    public BuilderPlayer(String name) {
        super(name);
    }

    /**
     * 
     * @param options
     * @return
     */
    protected Option chooseWallType(List<? extends Option> options) {
        return options.get((new Random()).nextInt(options.size()));
    }

    /**
     * 
     * @param options
     * @return
     */
    protected Option chooseCard(List<? extends Option> options) {
        for (Option option : options){
            if (option instanceof WallCard) {
                return option;
            }
        }
        return options.get(0); // no wall card
    }

    /**
     * 
     * @param options
     * @return
     */
    protected Option chooseAction(List<? extends Option> options) {
        for (Option option : options){
            if (option instanceof PlayCardAction) {
                return option;
            }
        }
        return options.get(0); // no PlayAction
    }

}
